﻿Public Partial Class admin_aula
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnInsertar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnInsertar.Click
        Me.lblscript.Text = "<script type='text/javascript'>valida()</script>"
        Try
            Dim cl As New ASI_2UFG_BL.class_admin
            cl.Insertar_Aula("I", txtNumero.Text, txtdescripcion.Text, dropEstado.SelectedValue, TXTCapacida.Text, 0)
            If cl.log = 0 Then
                Me.lbMensaje.Text = "<script type='text/javascript'>validar();</script>"
                '"<script type='text/javascript'>showDialogue();</script>"
                GridAula.DataBind()
            Else
                Me.lbMensaje.Text = "Error al ingresar el Registro"
            End If
        Catch ex As Exception
            MsgBox(ex, MsgBoxStyle.Critical)
        End Try
    End Sub

    Protected Sub btnModificar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnModificar.Click
        Try
            Dim cl As New ASI_2UFG_BL.class_admin
            cl.Modificar_Aula("M", txtID.Text, txtNumero.Text, txtdescripcion.Text, dropEstado.SelectedValue, TXTCapacida.Text, 0)
            If cl.log = 0 Then
                Me.lbMensaje.Text = "Modificado Con exito"
                GridAula.DataBind()
            Else
                Me.lbMensaje.Text = "Error al Modificar el Registro"
            End If
        Catch ex As Exception
            MsgBox(ex, MsgBoxStyle.Critical)
        End Try
    End Sub

    Protected Sub btnEliminar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnEliminar.Click
        Try
            Dim cl As New ASI_2UFG_BL.class_admin
            cl.Eliminar_Aula("E", txtID.Text, 0)
            If cl.log = 0 Then
                Me.lbMensaje.Text = "Eliminado Con exito"
                GridAula.DataBind()
            Else
                Me.lbMensaje.Text = "Error al Eliminar el Registro"
            End If
        Catch ex As Exception
            MsgBox(ex, MsgBoxStyle.Critical)
        End Try
    End Sub

    Protected Sub GridAula_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridAula.SelectedIndexChanged
        'Me.textbox1.Text = GridView2.DataKeys(GridView2.SelectedIndex).Values("column1").ToString() 
        Me.txtID.Text = GridAula.DataKeys(GridAula.SelectedIndex).Value("ID").ToString()
    End Sub
End Class